import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 视频信息
 */
@Entity('video_video')
export class VideoVideoEntity extends BaseEntity {
  @Column({ comment: '名称', length: 255 })
  name: string;

  @Column({ comment: '封面', nullable: true })
  cover: string;

  @Column({ comment: '时长(秒)', type: 'int', default: 0 })
  duration: number;

  @Column({
    comment: '大小(MB)',
    type: 'decimal',
    precision: 10,
    scale: 2,
    default: 0.0,
  })
  size: number;

  @Column({ comment: '格式', dict: ['mp4', 'mov', 'avi', '其他'], default: 0 })
  format: number;

  @Column({ comment: '状态', dict: ['启用', '禁用'], default: 0 })
  status: number;

  @Index()
  @Column({ comment: '分类ID', nullable: true })
  categoryId: number;

  @Index()
  @Column({ comment: '作者', nullable: true })
  authorId: number;

  @Column({ comment: '标签(多个用逗号分隔)', nullable: true })
  tags: string;

  @Column({ comment: '简介', type: 'text', nullable: true })
  introduction: string;

  @Column({
    comment: '评分(0-5分)',
    type: 'decimal',
    precision: 2,
    scale: 1,
    default: 0.0,
  })
  score: number;

  @Column({ comment: '热度值', type: 'int', default: 0 })
  hot: number;
}
